# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from lianjia.Sql import Sql


class LianjiaPipeline(object):
    def process_item(self, item, spider):
        if isinstance(item, LianjiaItem):
            pic = item['pic']
            name = item['name']
            city = item['city']
            meters = item['meters']
            sizeDes = item['sizeDes']
            village = item['village']
            rent = item['rent']
            direction = item['direction']
            tag = item['tag']
            ret = Sql.insert_linked(pic, name, city, meters, sizeDes, village, rent, direction)
            print('存储完毕')
        return item
